package com.zhhs.galaxyott.httpVolley.parser;

import org.json.JSONException;
import org.json.JSONObject;

import com.zhhs.galaxyott.httpVolley.response.BaseResponse;
import com.zhhs.galaxyott.httpVolley.response.IsOrderResponse;

/**
 * 是否订购过
 * 
 * 
 */
public class IsOrderParser extends BaseParser<IsOrderResponse> {

    @Override
    public BaseResponse parse(String jsonString) {
        IsOrderResponse mResponse = new IsOrderResponse();
        try {

            JSONObject json = new JSONObject(jsonString);
            parseMsg(json, mResponse);
            if (mResponse.errCode == 0) {
                if (json.has("result")) {
                    mResponse.setResult(json.getInt("result"));
                }
                if (json.has("movieId")) {
                    mResponse.setMovieId(json.getInt("movieId"));
                }
                if (json.has("caId")) {
                    mResponse.setCaId(json.optString("caId"));
                }

            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return mResponse;
    }

}
